package ba.jamax.ralfdb.domain;

import java.io.Serializable;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
import java.util.WeakHashMap;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.proxy.HibernateProxy;


/** 
 * Object mapping for hibernate-handled table: book.
 * @author autogenerated
 */

@JsonIgnoreProperties({"action"})
@Entity
@Table(name = "book", catalog = "jamax_ralfdb")
public class Book implements Cloneable, Serializable {

	private static final int LENGTH_255 = 255;
	private static final int LENGTH_253 = 253;
	private static final int LENGTH_102 = 102;
	private static final int LENGTH_100 = 100;
	private static final int LENGTH_50 = 50;
	private static final int LENGTH_30 = 30;
	private static final int LENGTH_10 = 10;
	private static final int LENGTH_8 = 8;

	/** Serial Version UID. */
	private static final long serialVersionUID = -558948919L;

	/** Use a WeakHashMap so entries will be garbage collected once all entities 
		referring to a saved hash are garbage collected themselves. */
	private static final Map<Serializable, Long> SAVED_HASHES =
		Collections.synchronizedMap(new WeakHashMap<Serializable, Long>());
	
	@Transient
	private volatile Long hashCode;
	
    @Basic
	@Column( name = "acquiredfrom", length = LENGTH_30  )
	private String acquiredfrom;

    @Basic
	@Column( name = "author", length = LENGTH_100  )
	private String author;

    @Basic
	@Column( name = "authorsort", length = LENGTH_102  )
	private String authorsort;

    @Basic
	@Column( name = "binding", length = LENGTH_30  )
	private String binding;

    @Basic
	@Column( name = "borrower", length = LENGTH_50  )
	private String borrower;

    @Basic
	@Column( name = "category", length = LENGTH_30  )
	private String category;

    @Basic
	@Column( name = "comment", columnDefinition="longtext" )
	private String comment;

    @Basic
	@Column( name = "contributor", length = LENGTH_100  )
	private String contributor;

    @Basic
	@Column( name = "contributorsort", length = LENGTH_102  )
	private String contributorsort;

    @Basic
	@Column( name = "country", length = LENGTH_50  )
	private String country;

    @Basic
	@Column( name = "custom01", length = LENGTH_50  )
	private String custom01;

    @Basic
	@Column( name = "custom02", length = LENGTH_50  )
	private String custom02;

    @Basic
	@Column( name = "custom03", length = LENGTH_50  )
	private String custom03;

    @Basic
	@Column( name = "custom04", length = LENGTH_50  )
	private String custom04;

    @Basic
	@Column( name = "custom05", length = LENGTH_50  )
	private String custom05;

    @Basic
	@Column( name = "custom06", length = LENGTH_50  )
	private String custom06;

    @Basic
	@Column( name = "custom07", length = LENGTH_50  )
	private String custom07;

    @Basic
	@Column( name = "custom08", length = LENGTH_50  )
	private String custom08;

    @Basic
	@Column( name = "dateborrowed", length = LENGTH_8  )
	private String dateborrowed;

    @Basic
	@Column( name = "datedue", length = LENGTH_8  )
	private String datedue;

    @Basic
	@Column( name = "datepurchased", length = LENGTH_8  )
	private String datepurchased;

    @Basic
	@Column( name = "edition", length = LENGTH_30  )
	private String edition;

    @Basic
	@Column( name = "editor", length = LENGTH_100  )
	private String editor;

    @Basic
	@Column( name = "editorsort", length = LENGTH_102  )
	private String editorsort;

    @Basic
	@Column( name = "ghostwriter", length = LENGTH_100  )
	private String ghostwriter;

    @Basic
	@Column( name = "ghostwritersort", length = LENGTH_102  )
	private String ghostwritersort;
    
    @Id 
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column( name = "bookid", nullable = false  )
	private Long id = 0L; // init for hibernate bug workaround

    @Basic
	@Column( name = "isbn", length = LENGTH_255  )
	private String isbn;

    @Basic
	@Column( name = "keywords", length = LENGTH_50  )
	private String keywords;

    @Basic
	@Column( name = "language", length = LENGTH_30  )
	private String language;

    @Basic
	@Column( name = "lccn", length = LENGTH_30  )
	private String lccn;

    @Basic
	@Column( name = "location", length = LENGTH_50  )
	private String location;

    @Basic	
	@Column( name = "marked" )
	private Boolean marked;

    @Basic	
	@Column( name = "modified" )
	private Date modified;

    @Basic
	@Column( name = "originalcountry", length = LENGTH_50  )
	private String originalcountry;

    @Basic
	@Column( name = "originaldate", length = LENGTH_8  )
	private String originaldate;

    @Basic
	@Column( name = "originallanguage", length = LENGTH_50  )
	private String originallanguage;

    @Basic
	@Column( name = "originalpublisher", length = LENGTH_50  )
	private String originalpublisher;

    @Basic
	@Column( name = "originaltitle", length = LENGTH_255  )
	private String originaltitle;

    @Basic
	@Column( name = "overview", columnDefinition="longtext"  )
	private String overview;

    @Basic
	@Column( name = "owner", length = LENGTH_30  )
	private String owner;

    @Basic
	@Column( name = "pages", length = LENGTH_10  )
	private String pages;

    @Basic
	@Column( name = "picture", length = LENGTH_255  )
	private String picture;

    @Basic	
	private Double price;
	@Column( name = "printedby", length = LENGTH_50  )
	private String printedby;

    @Basic
	@Column( name = "printing", length = LENGTH_30  )
	private String printing;

    @Basic
	@Column( name = "publishdate", length = LENGTH_8  )
	private String publishdate;

    @Basic
	@Column( name = "publisher", length = LENGTH_50  )
	private String publisher;

    @Basic
	@Column( name = "rating" )
	private Integer rating;

    //@Basic
	@Column( name = "`read`" )
	private Boolean read;
    
    @Basic
	@Column( name = "readwhen", length = LENGTH_8  )
	private String readwhen;

    @Basic
	@Column( name = "referenceno", length = LENGTH_30  )
	private String referenceno;

    @Basic
	@Column( name = "review", columnDefinition="longtext"  )
	private String review;

    @Basic
	@Column( name = "status", length = LENGTH_30  )
	private String status;

    @Basic
	@Column( name = "subcategory", length = LENGTH_30  )
	private String subcategory;

    @Basic
	@Column( name = "subtitle", length = LENGTH_255  )
	private String subtitle;

    @Basic
	@Column( name = "title", length = LENGTH_253  )
	private String title;

    @Basic
	@Column( name = "titlesort", length = LENGTH_255  )
	private String titlesort;

    @Basic
	@Column( name = "translator", length = LENGTH_100  )
	private String translator;

    @Basic
	@Column( name = "translatorsort", length = LENGTH_102  )
	private String translatorsort;

    @Basic
	@Column( name = "type", length = LENGTH_30  )
	private String type;

    @Basic
	@Column( name = "url", columnDefinition="longtext"  )
	private String url;

    @Basic
	@Column( name = "value" )
	private Double value;

    @Basic
	@Column( name = "year", length = LENGTH_8  )
	private String year;

	public Book() {
		// Default constructor
	} 

	public Book(Long id) {
		this.id = id;
	}

	@Transient
	@JsonIgnore
	public Class<?> getClassType() {
		return Book.class;
	}

	public String getAcquiredfrom() {
		return this.acquiredfrom;		
	}

	public void setAcquiredfrom(final String acquiredfrom) {
		this.acquiredfrom = acquiredfrom;
	}

	public String getAuthor() {
		return this.author;		
	}

	public void setAuthor(final String author) {
		this.author = author;
	}

	public String getAuthorsort() {
		return this.authorsort;		
	}

	public void setAuthorsort(final String authorsort) {
		this.authorsort = authorsort;
	}

	public String getBinding() {
		return this.binding;		
	}

	public void setBinding(final String binding) {
		this.binding = binding;
	}

	public String getBorrower() {
		return this.borrower;		
	}

	public void setBorrower(final String borrower) {
		this.borrower = borrower;
	}

	public String getCategory() {
		return this.category;		
	}
	
	public void setCategory(final String category) {
		this.category = category;
	}

	public String getComment() {
		return this.comment;		
	}

	public void setComment(final String comment) {
		this.comment = comment;
	}

	public String getContributor() {
		return this.contributor;		
	}

	public void setContributor(final String contributor) {
		this.contributor = contributor;
	}

	public String getContributorsort() {
		return this.contributorsort;		
	}

	public void setContributorsort(final String contributorsort) {
		this.contributorsort = contributorsort;
	}

	public String getCountry() {
		return this.country;
		
	}

	public void setCountry(final String country) {
		this.country = country;
	}

	public String getCustom01() {
		return this.custom01;		
	}
	
	public void setCustom01(final String custom01) {
		this.custom01 = custom01;
	}

	public String getCustom02() {
		return this.custom02;		
	}

	public void setCustom02(final String custom02) {
		this.custom02 = custom02;
	}

	public String getCustom03() {
		return this.custom03;		
	}

	public void setCustom03(final String custom03) {
		this.custom03 = custom03;
	}

	public String getCustom04() {
		return this.custom04;		
	}

	public void setCustom04(final String custom04) {
		this.custom04 = custom04;
	}

	public String getCustom05() {
		return this.custom05;		
	}

	public void setCustom05(final String custom05) {
		this.custom05 = custom05;
	}

	public String getCustom06() {
		return this.custom06;		
	}

	public void setCustom06(final String custom06) {
		this.custom06 = custom06;
	}

	public String getCustom07() {
		return this.custom07;		
	}

	public void setCustom07(final String custom07) {
		this.custom07 = custom07;
	}

	public String getCustom08() {
		return this.custom08;		
	}

	public void setCustom08(final String custom08) {
		this.custom08 = custom08;
	}

	public String getDateborrowed() {
		return this.dateborrowed;		
	}

	public void setDateborrowed(final String dateborrowed) {
		this.dateborrowed = dateborrowed;
	}

	public String getDatedue() {
		return this.datedue;
		
	}

	public void setDatedue(final String datedue) {
		this.datedue = datedue;
	}

	public String getDatepurchased() {
		return this.datepurchased;		
	}

	public void setDatepurchased(final String datepurchased) {
		this.datepurchased = datepurchased;
	}

	public String getEdition() {
		return this.edition;		
	}

	public void setEdition(final String edition) {
		this.edition = edition;
	}

	public String getEditor() {
		return this.editor;		
	}

	public void setEditor(final String editor) {
		this.editor = editor;
	}

	public String getEditorsort() {
		return this.editorsort;		
	}

	public void setEditorsort(final String editorsort) {
		this.editorsort = editorsort;
	}

	public String getGhostwriter() {
		return this.ghostwriter;		
	}

	public void setGhostwriter(final String ghostwriter) {
		this.ghostwriter = ghostwriter;
	}

	public String getGhostwritersort() {
		return this.ghostwritersort;		
	}

	public void setGhostwritersort(final String ghostwritersort) {
		this.ghostwritersort = ghostwritersort;
	}

	public Long getId() {
		return this.id;		
	}

	public void setId(final Long id) {
		// If we've just been persisted and hashCode has been
		// returned then make sure other entities with this
		// ID return the already returned hash code
		if ( (this.id == null || this.id == 0) &&
				(id != null) &&
				(this.hashCode != null) ) {
			SAVED_HASHES.put( id, this.hashCode );
		}
		this.id = id;
	}

	public String getIsbn() {
		return this.isbn;
		
	}

	public void setIsbn(final String isbn) {
		this.isbn = isbn;
	}

	public String getKeywords() {
		return this.keywords;		
	}

	public void setKeywords(final String keywords) {
		this.keywords = keywords;
	}

	public String getLanguage() {
		return this.language;		
	}

	public void setLanguage(final String language) {
		this.language = language;
	}

	public String getLccn() {
		return this.lccn;		
	}

	public void setLccn(final String lccn) {
		this.lccn = lccn;
	}

	public String getLocation() {
		return this.location;		
	}

	public void setLocation(final String location) {
		this.location = location;
	}

	public Boolean isMarked() {
		return this.marked;		
	}

	public void setMarked(final Boolean marked) {
		this.marked = marked;
	}

	public Date getModified() {
		return this.modified;		
	}

	public void setModified(final Date modified) {
		this.modified = modified;
	}

	public String getOriginalcountry() {
		return this.originalcountry;		
	}

	public void setOriginalcountry(final String originalcountry) {
		this.originalcountry = originalcountry;
	}

	public String getOriginaldate() {
		return this.originaldate;		
	}

	public void setOriginaldate(final String originaldate) {
		this.originaldate = originaldate;
	}

	public String getOriginallanguage() {
		return this.originallanguage;		
	}

	public void setOriginallanguage(final String originallanguage) {
		this.originallanguage = originallanguage;
	}

	public String getOriginalpublisher() {
		return this.originalpublisher;		
	}
	
	public void setOriginalpublisher(final String originalpublisher) {
		this.originalpublisher = originalpublisher;
	}

	public String getOriginaltitle() {
		return this.originaltitle;		
	}

	public void setOriginaltitle(final String originaltitle) {
		this.originaltitle = originaltitle;
	}

	public String getOverview() {
		return this.overview;		
	}

	public void setOverview(final String overview) {
		this.overview = overview;
	}

	public String getOwner() {
		return this.owner;		
	}

	public void setOwner(final String owner) {
		this.owner = owner;
	}

	public String getPages() {
		return this.pages;		
	}

	public void setPages(final String pages) {
		this.pages = pages;
	}

	public String getPicture() {
		return this.picture;		
	}

	public void setPicture(final String picture) {
		this.picture = picture;
	}

	public Double getPrice() {
		return this.price;		
	}

	public void setPrice(final Double price) {
		this.price = price;
	}

	public String getPrintedby() {
		return this.printedby;		
	}

	public void setPrintedby(final String printedby) {
		this.printedby = printedby;
	}

	public String getPrinting() {
		return this.printing;		
	}

	public void setPrinting(final String printing) {
		this.printing = printing;
	}

	public String getPublishdate() {
		return this.publishdate;		
	}

	public void setPublishdate(final String publishdate) {
		this.publishdate = publishdate;
	}

	public String getPublisher() {
		return this.publisher;		
	}

	public void setPublisher(final String publisher) {
		this.publisher = publisher;
	}

	public Integer getRating() {
		return this.rating;		
	}

	public void setRating(final Integer rating) {
		this.rating = rating;
	}

	public Boolean isRead() {
		return this.read;		
	}

	public void setRead(final Boolean read) {
		this.read = read;
	}

	public String getReadwhen() {
		return this.readwhen;		
	}

	public void setReadwhen(final String readwhen) {
		this.readwhen = readwhen;
	}

	public String getReferenceno() {
		return this.referenceno;		
	}

	public void setReferenceno(final String referenceno) {
		this.referenceno = referenceno;
	}

	public String getReview() {
		return this.review;		
	}

	public void setReview(final String review) {
		this.review = review;
	}

	public String getStatus() {
		return this.status;		
	}

	public void setStatus(final String status) {
		this.status = status;
	}

	public String getSubcategory() {
		return this.subcategory;		
	}

	public void setSubcategory(final String subcategory) {
		this.subcategory = subcategory;
	}

	public String getSubtitle() {
		return this.subtitle;		
	}

	public void setSubtitle(final String subtitle) {
		this.subtitle = subtitle;
	}

	public String getTitle() {
		return this.title;		
	}

	public void setTitle(final String title) {
		this.title = title;
	}

	public String getTitlesort() {
		return this.titlesort;		
	}

	public void setTitlesort(final String titlesort) {
		this.titlesort = titlesort;
	}

	public String getTranslator() {
		return this.translator;		
	}

	public void setTranslator(final String translator) {
		this.translator = translator;
	}

	public String getTranslatorsort() {
		return this.translatorsort;		
	}

	public void setTranslatorsort(final String translatorsort) {
		this.translatorsort = translatorsort;
	}

	public String getType() {
		return this.type;		
	}

	public void setType(final String type) {
		this.type = type;
	}

	public String getUrl() {
		return this.url;		
	}

	public void setUrl(final String url) {
		this.url = url;
	}

	public Double getValue() {
		return this.value;		
	}

	public void setValue(final Double value) {
		this.value = value;
	}
	
	public String getYear() {
		return this.year;		
	}

	public void setYear(final String year) {
		this.year = year;
	}


   /**
    * Deep copy.
	* @return cloned object
	* @throws CloneNotSupportedException on error
    */
    @Override
    public Book clone() throws CloneNotSupportedException {
		
        final Book copy = (Book)super.clone();

		copy.setAcquiredfrom(this.getAcquiredfrom());
		copy.setAuthor(this.getAuthor());
		copy.setAuthorsort(this.getAuthorsort());
		copy.setBinding(this.getBinding());
		copy.setBorrower(this.getBorrower());
		copy.setCategory(this.getCategory());
		copy.setComment(this.getComment());
		copy.setContributor(this.getContributor());
		copy.setContributorsort(this.getContributorsort());
		copy.setCountry(this.getCountry());
		copy.setCustom01(this.getCustom01());
		copy.setCustom02(this.getCustom02());
		copy.setCustom03(this.getCustom03());
		copy.setCustom04(this.getCustom04());
		copy.setCustom05(this.getCustom05());
		copy.setCustom06(this.getCustom06());
		copy.setCustom07(this.getCustom07());
		copy.setCustom08(this.getCustom08());
		copy.setDateborrowed(this.getDateborrowed());
		copy.setDatedue(this.getDatedue());
		copy.setDatepurchased(this.getDatepurchased());
		copy.setEdition(this.getEdition());
		copy.setEditor(this.getEditor());
		copy.setEditorsort(this.getEditorsort());
		copy.setGhostwriter(this.getGhostwriter());
		copy.setGhostwritersort(this.getGhostwritersort());
		copy.setId(this.getId());
		copy.setIsbn(this.getIsbn());
		copy.setKeywords(this.getKeywords());
		copy.setLanguage(this.getLanguage());
		copy.setLccn(this.getLccn());
		copy.setLocation(this.getLocation());
		copy.setMarked(this.isMarked());
		copy.setModified(this.getModified());
		copy.setOriginalcountry(this.getOriginalcountry());
		copy.setOriginaldate(this.getOriginaldate());
		copy.setOriginallanguage(this.getOriginallanguage());
		copy.setOriginalpublisher(this.getOriginalpublisher());
		copy.setOriginaltitle(this.getOriginaltitle());
		copy.setOverview(this.getOverview());
		copy.setOwner(this.getOwner());
		copy.setPages(this.getPages());
		copy.setPicture(this.getPicture());
		copy.setPrice(this.getPrice());
		copy.setPrintedby(this.getPrintedby());
		copy.setPrinting(this.getPrinting());
		copy.setPublishdate(this.getPublishdate());
		copy.setPublisher(this.getPublisher());
		copy.setRating(this.getRating());
		copy.setRead(this.isRead());
		copy.setReadwhen(this.getReadwhen());
		copy.setReferenceno(this.getReferenceno());
		copy.setReview(this.getReview());
		copy.setStatus(this.getStatus());
		copy.setSubcategory(this.getSubcategory());
		copy.setSubtitle(this.getSubtitle());
		copy.setTitle(this.getTitle());
		copy.setTitlesort(this.getTitlesort());
		copy.setTranslator(this.getTranslator());
		copy.setTranslatorsort(this.getTranslatorsort());
		copy.setType(this.getType());
		copy.setUrl(this.getUrl());
		copy.setValue(this.getValue());
		copy.setYear(this.getYear());
		return copy;
	}
	


	/** Provides toString implementation.
	 * @see java.lang.Object#toString()
	 * @return String representation of this class.
	 */
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		
		sb.append("acquiredfrom: " + this.getAcquiredfrom() + ", ");
		sb.append("author: " + this.getAuthor() + ", ");
		sb.append("authorsort: " + this.getAuthorsort() + ", ");
		sb.append("binding: " + this.getBinding() + ", ");
		sb.append("borrower: " + this.getBorrower() + ", ");
		sb.append("category: " + this.getCategory() + ", ");
		sb.append("comment: " + this.getComment() + ", ");
		sb.append("contributor: " + this.getContributor() + ", ");
		sb.append("contributorsort: " + this.getContributorsort() + ", ");
		sb.append("country: " + this.getCountry() + ", ");
		sb.append("custom01: " + this.getCustom01() + ", ");
		sb.append("custom02: " + this.getCustom02() + ", ");
		sb.append("custom03: " + this.getCustom03() + ", ");
		sb.append("custom04: " + this.getCustom04() + ", ");
		sb.append("custom05: " + this.getCustom05() + ", ");
		sb.append("custom06: " + this.getCustom06() + ", ");
		sb.append("custom07: " + this.getCustom07() + ", ");
		sb.append("custom08: " + this.getCustom08() + ", ");
		sb.append("dateborrowed: " + this.getDateborrowed() + ", ");
		sb.append("datedue: " + this.getDatedue() + ", ");
		sb.append("datepurchased: " + this.getDatepurchased() + ", ");
		sb.append("edition: " + this.getEdition() + ", ");
		sb.append("editor: " + this.getEditor() + ", ");
		sb.append("editorsort: " + this.getEditorsort() + ", ");
		sb.append("ghostwriter: " + this.getGhostwriter() + ", ");
		sb.append("ghostwritersort: " + this.getGhostwritersort() + ", ");
		sb.append("id: " + this.getId() + ", ");
		sb.append("isbn: " + this.getIsbn() + ", ");
		sb.append("keywords: " + this.getKeywords() + ", ");
		sb.append("language: " + this.getLanguage() + ", ");
		sb.append("lccn: " + this.getLccn() + ", ");
		sb.append("location: " + this.getLocation() + ", ");
		sb.append("marked: " + this.isMarked() + ", ");
		sb.append("modified: " + this.getModified() + ", ");
		sb.append("originalcountry: " + this.getOriginalcountry() + ", ");
		sb.append("originaldate: " + this.getOriginaldate() + ", ");
		sb.append("originallanguage: " + this.getOriginallanguage() + ", ");
		sb.append("originalpublisher: " + this.getOriginalpublisher() + ", ");
		sb.append("originaltitle: " + this.getOriginaltitle() + ", ");
		sb.append("overview: " + this.getOverview() + ", ");
		sb.append("owner: " + this.getOwner() + ", ");
		sb.append("pages: " + this.getPages() + ", ");
		sb.append("picture: " + this.getPicture() + ", ");
		sb.append("price: " + this.getPrice() + ", ");
		sb.append("printedby: " + this.getPrintedby() + ", ");
		sb.append("printing: " + this.getPrinting() + ", ");
		sb.append("publishdate: " + this.getPublishdate() + ", ");
		sb.append("publisher: " + this.getPublisher() + ", ");
		sb.append("rating: " + this.getRating() + ", ");
		sb.append("read: " + this.isRead() + ", ");
		sb.append("readwhen: " + this.getReadwhen() + ", ");
		sb.append("referenceno: " + this.getReferenceno() + ", ");
		sb.append("review: " + this.getReview() + ", ");
		sb.append("status: " + this.getStatus() + ", ");
		sb.append("subcategory: " + this.getSubcategory() + ", ");
		sb.append("subtitle: " + this.getSubtitle() + ", ");
		sb.append("title: " + this.getTitle() + ", ");
		sb.append("titlesort: " + this.getTitlesort() + ", ");
		sb.append("translator: " + this.getTranslator() + ", ");
		sb.append("translatorsort: " + this.getTranslatorsort() + ", ");
		sb.append("type: " + this.getType() + ", ");
		sb.append("url: " + this.getUrl() + ", ");
		sb.append("value: " + this.getValue() + ", ");
		sb.append("year: " + this.getYear());
		return sb.toString();		
	}

	@Override
	public boolean equals(final Object aThat) {
		Object proxyThat = aThat;
		
		if ( this == aThat ) {
			 return true;
		}
		
		if (aThat instanceof HibernateProxy) {
 			// narrow down the proxy to the class we are dealing with.
 			try {
				proxyThat = ((HibernateProxy) aThat).getHibernateLazyInitializer().getImplementation(); 
			} catch (org.hibernate.ObjectNotFoundException e) {
				return false;
		   	}
		}
		if (aThat == null)  {
			 return false;
		}
		
		final Book that; 
		try {
			that = (Book) proxyThat;
			if ( !(that.getClassType().equals(this.getClassType()))){
				return false;
			}
		} catch (Exception e) {
				return false;
		}		
		
		boolean result = ((this.getId() == null) && ( that.getId() == null)) || (this.getId() != null  && this.getId().equals(that.getId()));
		/*result = result && (((getAcquiredfrom() == null) && (that.getAcquiredfrom() == null)) || (getAcquiredfrom() != null && getAcquiredfrom().equals(that.getAcquiredfrom())));
		result = result && (((getAuthor() == null) && (that.getAuthor() == null)) || (getAuthor() != null && getAuthor().equals(that.getAuthor())));
		result = result && (((getAuthorsort() == null) && (that.getAuthorsort() == null)) || (getAuthorsort() != null && getAuthorsort().equals(that.getAuthorsort())));
		result = result && (((getBinding() == null) && (that.getBinding() == null)) || (getBinding() != null && getBinding().equals(that.getBinding())));
		result = result && (((getBorrower() == null) && (that.getBorrower() == null)) || (getBorrower() != null && getBorrower().equals(that.getBorrower())));
		result = result && (((getCategory() == null) && (that.getCategory() == null)) || (getCategory() != null && getCategory().equals(that.getCategory())));
		result = result && (((getComment() == null) && (that.getComment() == null)) || (getComment() != null && getComment().equals(that.getComment())));
		result = result && (((getContributor() == null) && (that.getContributor() == null)) || (getContributor() != null && getContributor().equals(that.getContributor())));
		result = result && (((getContributorsort() == null) && (that.getContributorsort() == null)) || (getContributorsort() != null && getContributorsort().equals(that.getContributorsort())));
		result = result && (((getCountry() == null) && (that.getCountry() == null)) || (getCountry() != null && getCountry().equals(that.getCountry())));
		result = result && (((getCustom01() == null) && (that.getCustom01() == null)) || (getCustom01() != null && getCustom01().equals(that.getCustom01())));
		result = result && (((getCustom02() == null) && (that.getCustom02() == null)) || (getCustom02() != null && getCustom02().equals(that.getCustom02())));
		result = result && (((getCustom03() == null) && (that.getCustom03() == null)) || (getCustom03() != null && getCustom03().equals(that.getCustom03())));
		result = result && (((getCustom04() == null) && (that.getCustom04() == null)) || (getCustom04() != null && getCustom04().equals(that.getCustom04())));
		result = result && (((getCustom05() == null) && (that.getCustom05() == null)) || (getCustom05() != null && getCustom05().equals(that.getCustom05())));
		result = result && (((getCustom06() == null) && (that.getCustom06() == null)) || (getCustom06() != null && getCustom06().equals(that.getCustom06())));
		result = result && (((getCustom07() == null) && (that.getCustom07() == null)) || (getCustom07() != null && getCustom07().equals(that.getCustom07())));
		result = result && (((getCustom08() == null) && (that.getCustom08() == null)) || (getCustom08() != null && getCustom08().equals(that.getCustom08())));
		result = result && (((getDateborrowed() == null) && (that.getDateborrowed() == null)) || (getDateborrowed() != null && getDateborrowed().equals(that.getDateborrowed())));
		result = result && (((getDatedue() == null) && (that.getDatedue() == null)) || (getDatedue() != null && getDatedue().equals(that.getDatedue())));
		result = result && (((getDatepurchased() == null) && (that.getDatepurchased() == null)) || (getDatepurchased() != null && getDatepurchased().equals(that.getDatepurchased())));
		result = result && (((getEdition() == null) && (that.getEdition() == null)) || (getEdition() != null && getEdition().equals(that.getEdition())));
		result = result && (((getEditor() == null) && (that.getEditor() == null)) || (getEditor() != null && getEditor().equals(that.getEditor())));
		result = result && (((getEditorsort() == null) && (that.getEditorsort() == null)) || (getEditorsort() != null && getEditorsort().equals(that.getEditorsort())));
		result = result && (((getGhostwriter() == null) && (that.getGhostwriter() == null)) || (getGhostwriter() != null && getGhostwriter().equals(that.getGhostwriter())));
		result = result && (((getGhostwritersort() == null) && (that.getGhostwritersort() == null)) || (getGhostwritersort() != null && getGhostwritersort().equals(that.getGhostwritersort())));
		result = result && (((getIsbn() == null) && (that.getIsbn() == null)) || (getIsbn() != null && getIsbn().equals(that.getIsbn())));
		result = result && (((getKeywords() == null) && (that.getKeywords() == null)) || (getKeywords() != null && getKeywords().equals(that.getKeywords())));
		result = result && (((getLanguage() == null) && (that.getLanguage() == null)) || (getLanguage() != null && getLanguage().equals(that.getLanguage())));
		result = result && (((getLccn() == null) && (that.getLccn() == null)) || (getLccn() != null && getLccn().equals(that.getLccn())));
		result = result && (((getLocation() == null) && (that.getLocation() == null)) || (getLocation() != null && getLocation().equals(that.getLocation())));
		result = result && (((isMarked() == null) && (that.isMarked() == null)) || (isMarked() != null && isMarked().equals(that.isMarked())));
		result = result && (((getModified() == null) && (that.getModified() == null)) || (getModified() != null && getModified().equals(that.getModified())));
		result = result && (((getOriginalcountry() == null) && (that.getOriginalcountry() == null)) || (getOriginalcountry() != null && getOriginalcountry().equals(that.getOriginalcountry())));
		result = result && (((getOriginaldate() == null) && (that.getOriginaldate() == null)) || (getOriginaldate() != null && getOriginaldate().equals(that.getOriginaldate())));
		result = result && (((getOriginallanguage() == null) && (that.getOriginallanguage() == null)) || (getOriginallanguage() != null && getOriginallanguage().equals(that.getOriginallanguage())));
		result = result && (((getOriginalpublisher() == null) && (that.getOriginalpublisher() == null)) || (getOriginalpublisher() != null && getOriginalpublisher().equals(that.getOriginalpublisher())));
		result = result && (((getOriginaltitle() == null) && (that.getOriginaltitle() == null)) || (getOriginaltitle() != null && getOriginaltitle().equals(that.getOriginaltitle())));
		result = result && (((getOverview() == null) && (that.getOverview() == null)) || (getOverview() != null && getOverview().equals(that.getOverview())));
		result = result && (((getOwner() == null) && (that.getOwner() == null)) || (getOwner() != null && getOwner().equals(that.getOwner())));
		result = result && (((getPages() == null) && (that.getPages() == null)) || (getPages() != null && getPages().equals(that.getPages())));
		result = result && (((getPicture() == null) && (that.getPicture() == null)) || (getPicture() != null && getPicture().equals(that.getPicture())));
		result = result && (((getPrice() == null) && (that.getPrice() == null)) || (getPrice() != null && getPrice().equals(that.getPrice())));
		result = result && (((getPrintedby() == null) && (that.getPrintedby() == null)) || (getPrintedby() != null && getPrintedby().equals(that.getPrintedby())));
		result = result && (((getPrinting() == null) && (that.getPrinting() == null)) || (getPrinting() != null && getPrinting().equals(that.getPrinting())));
		result = result && (((getPublishdate() == null) && (that.getPublishdate() == null)) || (getPublishdate() != null && getPublishdate().equals(that.getPublishdate())));
		result = result && (((getPublisher() == null) && (that.getPublisher() == null)) || (getPublisher() != null && getPublisher().equals(that.getPublisher())));
		result = result && (((getRating() == null) && (that.getRating() == null)) || (getRating() != null && getRating().equals(that.getRating())));
		result = result && (((isRead() == null) && (that.isRead() == null)) || (isRead() != null && isRead().equals(that.isRead())));
		result = result && (((getReadwhen() == null) && (that.getReadwhen() == null)) || (getReadwhen() != null && getReadwhen().equals(that.getReadwhen())));
		result = result && (((getReferenceno() == null) && (that.getReferenceno() == null)) || (getReferenceno() != null && getReferenceno().equals(that.getReferenceno())));
		result = result && (((getReview() == null) && (that.getReview() == null)) || (getReview() != null && getReview().equals(that.getReview())));
		result = result && (((getStatus() == null) && (that.getStatus() == null)) || (getStatus() != null && getStatus().equals(that.getStatus())));
		result = result && (((getSubcategory() == null) && (that.getSubcategory() == null)) || (getSubcategory() != null && getSubcategory().equals(that.getSubcategory())));
		result = result && (((getSubtitle() == null) && (that.getSubtitle() == null)) || (getSubtitle() != null && getSubtitle().equals(that.getSubtitle())));
		result = result && (((getTitle() == null) && (that.getTitle() == null)) || (getTitle() != null && getTitle().equals(that.getTitle())));
		result = result && (((getTitlesort() == null) && (that.getTitlesort() == null)) || (getTitlesort() != null && getTitlesort().equals(that.getTitlesort())));
		result = result && (((getTranslator() == null) && (that.getTranslator() == null)) || (getTranslator() != null && getTranslator().equals(that.getTranslator())));
		result = result && (((getTranslatorsort() == null) && (that.getTranslatorsort() == null)) || (getTranslatorsort() != null && getTranslatorsort().equals(that.getTranslatorsort())));
		result = result && (((getType() == null) && (that.getType() == null)) || (getType() != null && getType().equals(that.getType())));
		result = result && (((getUrl() == null) && (that.getUrl() == null)) || (getUrl() != null && getUrl().equals(that.getUrl())));
		result = result && (((getValue() == null) && (that.getValue() == null)) || (getValue() != null && getValue().equals(that.getValue())));
		result = result && (((getYear() == null) && (that.getYear() == null)) || (getYear() != null && getYear().equals(that.getYear())));*/
		return result;
	}
	
	/** Calculate the hashcode.
	 * @see java.lang.Object#hashCode()
	 * @return a calculated number
	 */
	@Override
	public int hashCode() {
		if ( this.hashCode == null ) {
			synchronized ( this ) {
				Long newHashCode = null;

				if ( getId() != null ) {
					newHashCode = SAVED_HASHES.get( getId() );
				}
				
				if ( newHashCode == null ) {
					if ( getId() != null && getId() != 0) {
						newHashCode = getId();
					} else {
						newHashCode = (long) super.hashCode();

					}
				}
				
				this.hashCode = newHashCode;
			}
		}
		
		return this.hashCode.intValue();
	}
}
